﻿#region Version Info Header
/*
 * $Id: ModelBase.cs 1070 2010-09-08 12:57:59Z t_rendelmann $
 * $HeadURL: https://rssbandit.svn.sourceforge.net/svnroot/rssbandit/trunk/source/RssBandit.AppServices/Core/ModelBase.cs $
 * Last modified by $Author: t_rendelmann $
 * Last modified at $Date: 2010-09-08 08:57:59 -0400 (Wed, 08 Sep 2010) $
 * $Revision: 1070 $
 */
#endregion

using System;
using System.ComponentModel;
using System.Linq.Expressions;

namespace OpenSearch.Client.Util
{
    [Serializable]
    public abstract class ModelBase : INotifyPropertyChanged
    {
        protected void OnPropertyChanged(PropertyChangedEventArgs args)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, args);
        }

        protected void OnPropertyChanged(Expression<Func<object>> expression)
        {
            PropertyChanged.Notify(expression);
        }

        [field : NonSerialized]
        public event PropertyChangedEventHandler PropertyChanged;
    }
}